<?php
// +----------------------------------------------------------------------
// | ThinkPHP
// +----------------------------------------------------------------------
// | Copyright (c) 2007 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// $Id$

// 话题模型
class NewModel extends CommonModel {
	protected $_validate	 =	 array(
		array('title','require','标题必须！'),
		array('content','require','内容必须'),
		);

	protected $_auto	 =	 array(
		//array('title','strip_tags',self::MODEL_BOTH,'function'),
		//array('content','strip_tags','function',self::MODEL_BOTH),
		array('status','1',self::MODEL_INSERT,'string'),
		array('create_time','time',self::MODEL_INSERT,'function'),
        array('update_time','time',self::MODEL_UPDATE,'function'),
		);

	// 在下面添加需要的数据访问方法
	public function top($condition){
        if(FALSE === $this->where($condition)->setField('is_top',array('exp','(1-is_top)'))){
            $this->error =  L('_OPERATION_WRONG_');
            return false;
        }else {
            return True;
        }
	}

}
?>